//---------------------------------------------------------------------------- // File: Win32_Defs.h // Type: Definition File // Author: Ken Anderson // Date: 2/23/3 // OS dependant: Windows // // Notes: Contains header files, typedefs, structs & definitions specific // to windows only. // // Header file's required: // 1) OS_API_Template.h -- The OS API Template that the Windows Management will // be built on, like a frame/foundation that defines // functions specifically needed for any OS. If an OS // does not define a function, then the function is designed // to return NA for not supported. // 2) CiMedia.h -- Contains the CiMedia class that will manage most media // management and manipulation. // 3) -- Absolutely required to manipulate the Windows OS system. // 4) -- ? // 5) -- ? // 6) Win32_Misc.h -- Misc functions that create a bridge between the program & // the windows operating system. // //---------------------------------------------------------------------------- #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 //////////////////////////// // DEFINITIONS // //////////////////////////// //#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers //////////////////////////// // INCLUDES // //////////////////////////// #include "OS_API_Template.h" #include "CiMedia.h" #include "Bitmap.h" #include #include #include #include "Win32_Misc.h" //////////////////////////// // STRUCTURE DEFINES // //////////////////////////// //////////////////////////// // FUNCTION DEFINES // //////////////////////////// INT WinMain_ENTRY(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nCmdShow); //////////////////////////// // CLASS LAYOUT // //////////////////////////// class IX_Window : OS_API_Template { public: BOOL m_bActive; //The active state of the program. private: ////////////////////////// //--WINDOWS PROPERTIES--// ////////////////////////// LPTSTR m_lpClassName; //Name of the class. LPTSTR m_lpWindowName; //Name of the window. LPTSTR m_lpMenuName; //Name of the menu resource. DWORD m_dwStyle; //Style of window INT m_iWinX, m_iWinY; //Windows location. INT m_iWinHeight; //Window Height INT m_iWinWidth; //Window Width ////////////////////////////// //--APPLICATION PROPERTIES--// ////////////////////////////// INT m_nCmdShow; //Window Visible properties. HWND m_hwnd; //Handle of the window. HMENU m_hmenu; //Handle of the menu. HICON m_hicon; //Icon of the window. HINSTANCE m_hinst; //Instance of the program. ////////////////////////// //--MESSAGE PROPERTIES--// ////////////////////////// BOOL m_bIdle; //Allows idling processing. /////////////////////////// //--CALLBACK PROPERTIES--// /////////////////////////// WNDPROC m_lpfnWndProc; //Pointer to the Windows Procedure. //////////////////////// //--PAINT PROPERTIES--// //////////////////////// PAINTSTRUCT m_ps; //Paint structure required for being & end paint for windows OS. HDC m_hdc; //Handle to the DC used in the windows graphics system. BOOL m_bBD; //A boolean value that represents true if beginpaint has started. public: //////////////////////// //--Class Dependants--// //////////////////////// IX_Window(HINSTANCE hinst, WNDPROC lpfnWndProc, LPTSTR ClassName=NULL, LPTSTR WindowName=NULL, INT nCmdShow=SW_SHOWNORMAL, INT iWidth=NULL, INT iHeight=NULL); ~IX_Window(); /////////////////////////// //--Program Controllers--// /////////////////////////// OS_ERR PrintMsg(cstr pMessage); OS_ERR Create(); OS_ERR Destroy(); OS_ERR Close(); ///////////////////////// //---Cursor Controls---// ///////////////////////// OS_ERR SetCursor(cstr pzCursor); ///////////////////////// //------Querries-------// ///////////////////////// OS_ERR GetClientSize(POSRect rc); OS_ERR GetWindowSize(POSRect rc); void QueryOS(POSQuery qc); cstr GetOS(); ///////////////////////// //--WINDOW SIZE & LOC--// ///////////////////////// OS_ERR SetWindowPos(int ix, int iy, int iWidth, int iHeight, OSZOrder zOrder, uint uFlag); OS_ERR SetWindowStyle(uint uStyle); ///////////////////////// //--------Tools--------// ///////////////////////// float Timer(OSTimerState TS); //Returns and controls the system timer. /////////////////////// //--Message Handler--// /////////////////////// bool Quit(MSG_EVENT state); bool GetMsg(MSG_EVENT* pMsgEvent, PDword pdwMsgValue); void SetMsg(MSG_EVENT MsgEvent, Dword dwMsgValue=0x00000000); bool SystemManager(); //Enable & Disable Idle are features that allow a program to run //in windows OS_ERR EnableIdle(){m_bIdle = TRUE; return EC_OK;} OS_ERR DisableIdle(){m_bIdle = FALSE; return EC_OK;} ///////////////////// // File Management // ///////////////////// OS_ERR CreateFile(void*** tvFileHandle, cstr psFileName, Dword dwAccess, Dword dwShare, Dword dwCreationMethod, Dword dwFlags); OS_ERR ReadFile(void** hvFile, void* pvBuffer, Dword dwBytesToRead, Dword* pvBytesRead, Dword dwOverlapped); OS_ERR WriteFile(void** hvFile, void* pvBuffer, Dword dwBytesToWrite, Dword* pvBytesWritten, Dword dwOverlapped); OS_ERR CloseFile(void** hvFile); Qword GetFileSize(void** hvFile); ////////////////////// //--Paint Handlers--// ////////////////////// OS_ERR DrawMedia(CiMedia* pciMedia, INT iX=0, INT iY=0, INT iWidth=0, INT iHeight=0); OS_ERR DrawRectangle(OSRect rc, Byte Red=255, Byte Blue=255, Byte Green=255); OS_ERR BeginDraw(); OS_ERR EndDraw(); /////////////////////////// //-----OS dependants-----// //ONLY use internally // //or in ENTRYPOINT CALLS // /////////////////////////// // Class Handles. VOID SetWindowState(INT CmdShow); VOID SetWindowHMenu(HMENU hmenu); VOID SetHInstance(HINSTANCE hinst); VOID SetWindowHIcon(HICON hicon); // Resource IDs. VOID SetWindowIcon(WORD wIconID); VOID SetWindowMenu(WORD wMenuID); // System Procedures. LRESULT CALLBACK WndProc(HWND hwnd, UINT uMSG, WPARAM wParam, LPARAM lParam); ////////////////////////// // *CRITICAL WARNING* // ////////////////////////// //WINDOWS ONLY. //DO NOT use this function in the main program that will be operating on multiple operating systems. //Only use this function in code that is operating system dependant such as DirectX. HWND GetHwnd(){ return m_hwnd; } private: ////////////////////// //--Paint Handlers--// ////////////////////// // Derived -- Only exists in this OS OS_ERR MapBitmapToScreen(HDC hdc, PBitmap pbm, INT iX=0, INT iY=0, INT iWidth=0, INT iHeight=0); /////////////////////////// //--Creation Parameters--// /////////////////////////// OS_ERR TranslateError(DWORD dwErr); VOID RegClass(WNDPROC lpfnWndProc); };